import requests

url = "https://www.baidu.com"

headers = {
    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/131.0.0.0'
}

response = requests.get("https://www.baidu.com/", headers=headers, params={'wd': '刘亦菲'})
with open('lyf2.html', 'w', encoding="utf-8") as f:
    f.write(response.content.decode('utf-8'))